/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lotus.tep.event;

import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserAdapter;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserNavigationEvent;
import com.lotus.tep.ui.VoiceUi;

/**
 *
 * @author arvind.sharma
 */
public class DefaultWebBrowserHandler extends WebBrowserAdapter {

	private VoiceUi voiceUi_;
	private VoiceUiHandler uiHandler_;

	private DefaultWebBrowserHandler(VoiceUiHandler uiHandler, VoiceUi voiceUi) {
		voiceUi_ = voiceUi;
		uiHandler_ = uiHandler;
	}

	public static DefaultWebBrowserHandler createDefaultWebBrowserHandler(VoiceUiHandler uiHandler, VoiceUi voiceUi) {
		DefaultWebBrowserHandler handler = new DefaultWebBrowserHandler(uiHandler, voiceUi);
		return handler;
	}

	@Override
	public void locationChanged(WebBrowserNavigationEvent e) {
		JWebBrowser browser = e.getWebBrowser();
		System.out.printf("browser url: %s\n", browser.getResourceLocation());
		browser = null;
	}
}
